package edu.sctu.wangxiaoqiang.day20150614.iostream_1;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;

/**
 * Created by user25 on 2015/6/14.
 */
public class IOText_1 {
    public void ioStream(){
        int a = 0;
        int b = 0;
        try {
            FileInputStream fileInputStream = new FileInputStream(new File("D:Hydrangeas.jpg"));
            try {
                while ((a = fileInputStream.read())!=-1){
                    b += a;
                }
                System.out.println(b);
            } catch (IOException e) {
                e.printStackTrace();
            }
            try {
                fileInputStream.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        }
    }
}
